/**
 * @file:          TrackingDifferentiator.h
 * @brief:         
 * @details:       
 * @author:        wjh
 * @date created:  2023.10.16
 * @version:       1.0.0
 * @par copyright (c):
 *   
 * @par history (desc):
 *   version:1.0.0, wjh, 2023.10.16,19:40:00
 */


#ifndef _TRACKINGDIFFERENTIATOR_H_
#define _TRACKINGDIFFERENTIATOR_H_

/* Include Files **************************************************************/
#include "Datatype.h"
#include "common.h"
#include "Fhan.h"

/* Macro Definition ***********************************************************/
enum TrackingDifferentiatorMode
{
    TDMode_Fhan = 0,
    TDMode_Linear = 1,
};


/* Data Type Define ***********************************************************/
typedef struct TrackingDifferentiator
{
    /* public data */
    uint16_t param_en;
    uint16_t param_single_turn_mode;
    uint16_t param_mode;
    float param_d_gain;
    float param_dd_gain;
    Fhan fhan;
    float param_h;
    float param_h0_gain_h;

    float v1;
    float v1_next;
    float v2;
    float v2_next;
    float y;
    float in_v;
    float out_x1;
    float out_x2;
    float out_g;
    
    /* private data */
    
    /* public method */
    void (*Init)(struct TrackingDifferentiator *self);
    float (*Run)(struct TrackingDifferentiator *self);
    float (*UpdateParam)(struct TrackingDifferentiator *self);
    
    /* private method */
    
}TrackingDifferentiator;
    
/* Variable Declare ***********************************************************/

/* Function Declare ***********************************************************/
void TrackingDifferentiator_Init(struct TrackingDifferentiator *self);
float TrackingDifferentiator_Run_Fhan(struct TrackingDifferentiator *self);
float TrackingDifferentiator_Run_Linear(struct TrackingDifferentiator *self);
float TrackingDifferentiator_UpdateParam(struct TrackingDifferentiator *self);


#endif